package cn.oa.service.impl;

import cn.oa.dao.AttendanceMapper;
import cn.oa.dao.DepartmentDao;
import cn.oa.entity.Department;
import cn.oa.service.DepartmentService;
import cn.oa.util.DatabaseUtil;
import cn.oa.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

@Service("departmentService")
public class DepartmentServiceImpl implements DepartmentService {
    @Resource
    DepartmentDao departmentDao;

//    public DepartmentDao getDepartmentDao() {
//        return departmentDao;
//    }
//
//    public void setDepartmentDao(DepartmentDao departmentDao) {
//        this.departmentDao = departmentDao;
//    }

    @Override
    public List<Department> getAllDepartments() throws SQLException {
        try{
            return departmentDao.getAllDepartments();
        }catch(SQLException e){
            e.printStackTrace();
            throw e;
        }
    }
}
